package com.guchenbo.example.io.pipe;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

/**
 * Created by CreGu on 2016/6/13.
 */
public class TestPipedStream {
    public static void main(String[] args) {
        Sender sender = new Sender();
        Receiver receiver = new Receiver();

        PipedInputStream inputStream=receiver.getInputStream();
        PipedOutputStream outputStream = sender.getOutputStream();

        try {
            inputStream.connect(outputStream);

            sender.start();
            receiver.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
